def enumerate(sequence, start=0):
    n = start
    for elem in sequence:
        yield n, elem
        n += 1


l = [1, 2, 3, 4]
for index, elem in enumerate(l):
    print(index, elem)


# 反序的

def r_enumerate(sequence):
    n = len(sequence)
    for elem in reversed(sequence):
        yield n - 1, elem
        n = n - 1


for i, e in r_enumerate(list('abcdef')):
    print(f'index:{i} element:{e}')
